<?php
/**
The Talis Platform organises authentication into a number of capabilities. A user can have any or all of these capabilities assigned to them.
Each service provided by the platform may require one of these capabilities to be used.
This class can be passed to other platform classes to supply any necessary authentication information. The class can be constructed
with a single username and password which will be used for all authentication requests. This is a the most normal mode of operation.
However, the username and password for each type of capability can be overridden on an individual basis.

See http://n2.talis.com/wiki/Capabilities for more information on Capabilities including which services require the user to
have which capability.
*/
class Credentials {
  var $credentials;

  function Credentials($username, $password) {
    $this->credentials = Array(
      'basic-search' => $username . ':' . $password ,
      'extended-search' => $username . ':' . $password ,
      'harvest' => $username . ':' . $password ,
      'versioned-update' => $username . ':' . $password ,
      'full-update' => $username . ':' . $password ,
      'configure-store' => $username . ':' . $password ,
      'configure-platform' => $username . ':' . $password ,
   );
  }

  function get_basic_search_auth() {
    return $this->credentials['basic-search'];
  }
  function get_extended_search_auth() {
    return $this->credentials['extended-search'];
  }
  function get_harvest_auth() {
    return $this->credentials['harvest'];
  }
  function get_versioned_update_auth() {
    return $this->credentials['versioned-update'];
  }
  function get_full_update_auth() {
    return $this->credentials['full-update'];
  }
  function get_configure_store_auth() {
    return $this->credentials['configure-store'];
  }
  function get_configure_platform_auth() {
    return $this->credentials['configure-platform'];
  }

  function set_basic_search_auth($username, $password) {
    $this->credentials['basic-search'] = $username . ':' . $password;
  }
  function set_extended_search_auth($username, $password) {
    $this->credentials['extended-search'] = $username . ':' . $password;
  }
  function set_harvest_auth($username, $password) {
    $this->credentials['harvest'] = $username . ':' . $password;
  }
  function set_versioned_update_auth($username, $password) {
    $this->credentials['versioned-update'] = $username . ':' . $password;
  }
  function set_full_update_auth($username, $password) {
    $this->credentials['full-update'] = $username . ':' . $password;
  }
  function set_configure_store_auth($username, $password) {
    $this->credentials['configure-store'] = $username . ':' . $password;
  }
  function set_configure_platform_auth($username, $password) {
    $this->credentials['configure-platform'] = $username . ':' . $password;
  }

}
?>